package cn.appkf.flappybird.ui;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.ui.Button;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;

import java.awt.HeadlessException;

/**
 * Created by Administrator on 2016/7/28.
 */
public class JumpButton extends Button {



    // 按钮 弹起 状态的纹理
    private Texture upTexture;

    // 按钮 按下 状态的纹理
    private Texture downTexture;

    ButtonStyle style;

    public JumpButton() {

         /*
         * 第 1 步: 创建 弹起 和 按下 两种状态的纹理
         */
         upTexture = new Texture(Gdx.files.internal("button/btn_jump.png"));
         downTexture = new Texture(Gdx.files.internal("button/btn2_jump.png"));

        /*
         * 第 2 步: 创建 ButtonStyle
         */
        style = new Button.ButtonStyle();

        // 设置 style 的 弹起 和 按下 状态的纹理区域
        style.up = new TextureRegionDrawable(new TextureRegion(upTexture));
        style.down = new TextureRegionDrawable(new TextureRegion(downTexture));

        this.setStyle(style);

    }


    public JumpButton(ButtonStyle style) {
        super(style);
    }
}
